#include<bits/stdc++.h>
using namespace std;
using ll = long long; 

int main()
{
	ll n,m;
	ll cnt=0,ans=0;
	cin >> n >> m;
	for(ll i=1;i<=n;i++)
	{
		ll x;
		cin >> x;
		if(cnt+x>m)
		{
			ans++;
			cnt=x; 
			i++;
		}
		else cnt+=x;
	}
	cout<<ans<<endl;
 } 
